import java.util.Stack;

/**
 * Class that holds the structure of a vehicle's path.
 * @author Jared Lindbl�m
 */
public class Path {
	private Stack<Section> path;

	/**
	 * Constructor.
	 */
	public Path() {
		path = new Stack<Section>();
	}

	/**
	 * Accessor Method (Path).
	 * @return The path of a vehicle.
	 */
	public Section[] getPath() {
		Section[] r = new Section[path.size()];
		path.toArray(r);
		return r;
	}

	/**
	 * Accessor Method (Current Road).
	 * @return	The road the vehicle is currently on.
	 */
	public Section peek() {
		return path.peek();
	}

	/**
	 * Adds a road to the path.
	 * @param road	The road to be added to the path.
	 */
	public void addRoadSection(Section roadSection) {
		path.push(roadSection);
	}

	/**
	 * Removes the most recent road from the path (backtrack).
	 */
	public void removeRoadSection() {
		path.pop();
	}
}
